#include <lore/mnemonic.hpp>
#include <lore/opcode.hpp>
#include <boost/foreach.hpp>

#define BOOST_TEST_MODULE MnemonicTestModule

#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_SUITE( MnemonicTestSuite )

BOOST_AUTO_TEST_CASE( mnemonic_opcode_conversion )
{
// Let's go through every mnemonic, and every change type. Compose it into an opcode. Then decompose it, and make sure it's right

	BOOST_FOREACH(Mnemonic mnem, all_mnemonics())
	{

		ChangeType cts[] = { CHANGE_OP, CHANGE_ARGA, CHANGE_ARGA, CHANGE_ARGB, CHANGE_RET };

		BOOST_FOREACH(ChangeType ct, cts) {
			Opcode op(to_opcode(mnem, ct));

			BOOST_CHECK_EQUAL(get_mnemonic(op), mnem);
			BOOST_CHECK_EQUAL(get_changetype(op), ct);
		}
	}
}




BOOST_AUTO_TEST_SUITE_END()
